<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!--账户设置-->
<div id="profile" style="display: block">
	<div id="loading-load" style="display: none;"></div>
	<div class="container">
		<div class="tabs-left">
			<ul class="nav nav-tabs nav-stacked" id="set-tab">
				<li class="active"><a href="#private-set">个人资料</a></li>
				<li><a href="#password-set">帐号密码</a></li>
				<li><a href="#note-set">通知设置</a></li>
				<li><a href="#binding-set">绑定设置	</a></li>
				<li><a href="#panel-address" class="tab2" data-toggle="tab" id="addressbtn">收货地址管理</a></li>
			</ul>
		</div>
		<div id="aa"></div>
		<div class="tab-content" id="homeProfile">
		<div class="tab-pane active" id="private-set">
			<!--个人资料-->
			<div class="content-private-date">

				<form id="proSet" method="post">
					<input type="hidden" name="id" value="" id="userId" />
					<table class="table table-hover">
						<thead>
							<tr class="home_jsb_title">
								<th class="activity_name" colspan="4" style="border-bottom:1px solid #ddd;">个人资料</th>
							</tr>
						</thead>
						<tbody id="proSetTbody">
						</tbody>
					</table>
				</form>
			</div>
		</div>
		<!--密码设置div-->
		<div class="tab-pane" id="password-set">
			<form action="" method="post" id="pwdSet">
				<input type="hidden" name="uid" id="uid" />
				<table class="table table-hover" id="password-table">
					<thead>
						<tr class="home_jsb_title">
							<th class="activity_name" colspan="4" style="border-bottom:1px solid #ddd;">密码设置</th>
						</tr>
					</thead>
					<tbody id="password-set-tbody">
						<tr>
							<td class="column1" colspan="4">
								<div>
									<div class="account-div-left">原密码</div>
									<input type="password" name="oldPassword" id="oldPassword"
									class="account-div-right" value="" />
								</div>
							</td>
						</tr>
						<tr>
							<td class="column1" colspan="4">
								<div class="account-div-left">新密码</div> <input type="password"
								name="newPassword" id="newPassword" class="account-div-right"
								value="" />
							</td>
						</tr>
						<tr>
							<td class="column1" colspan="4">
								<div class="account-div-left">确认密码</div> <input type="password"
								name="rePassword" id="rePassword" class="account-div-right"
								value="" />
							</td>
						</tr>
						<tr>
							<td class="column1" colspan="4">
								<div type="submit" class="account-set" value=""
								style="height: 40px; width: 120px; line-height: 40px; text-align: center; margin-left: 120px; cursor: pointer;">保存设置</div>
							</td>
						</tr>
					</tbody>
				</table>
			</form>
		</div>
		<!--通知设置-->
		<div class="tab-pane content-inform" id="note-set">
			<form action="" method="post" id="informSet">
				<table class="table table-hover">
					<thead>
						<tr class="home_jsb_title">
							<th class="activity_name" colspan="4" style="border-bottom:1px solid #ddd;">通知设置</th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td class="column1 inform_set inform" colspan="4">当有以下情况时，<span>发送邮件</span>给我
							</td>
						</tr>
						<tr>
							<td class="column1 inform" colspan="4">
									<input type="hidden" name="userSettings[0].userId" value=<shiro:principal property="id"/> /> 
									<input type="hidden" name="userSettings[0].metaKey" value="newMessage" /> 
									<input type="checkbox" class="checkbox" value="1" id="newMessage"
								name="userSettings[0].metaValue" /> <label for="newMessage">新消息通知</label>
							</td>
						</tr>
						<tr>
							<td class="column1 inform" colspan="4"><input type="hidden"
								name="userSettings[1].userId"
								value=<shiro:principal property="id"/> /> <input type="hidden"
								name="userSettings[1].metaKey" value="activity" /> <input
								type="checkbox" class="checkbox" value="1" id="activity"
								name="userSettings[1].metaValue" /> <label for="activity">
								YAMI服务通知</label>
							</td>
						</tr>
						<tr>
							<td class="column1 inform_set inform" colspan="4"><input
								type="hidden" name="userSettings[2].userId"
								value=<shiro:principal property="id"/> /> <input type="hidden"
								name="userSettings[2].metaKey" value="supportMe" /> <input
								type="checkbox" class="checkbox" value="1" id="supportMe"
								name="userSettings[2].metaValue" /> <label for="supportMe">当有人支持我的服务提醒</label>
							</td>
						</tr>
						<tr>
							<td class="column1 inform" colspan="4"><input type="submit"
								class="account-set" value="保存设置"
								style="height: 40px; width: 120px;" id="postSub" />
							</td>
						</tr>
					</tbody>
				</table>
			</form>
		</div>
		<div class="tab-pane" id="binding-set">
			<!--绑定设置div-->
			<div class="content-banden">
				<div class="point" style="border-bottom:1px solid #ddd;">
					<div class="point-massege" >绑定设置</div>
				</div>
				<div class="account-div-left"></div>
				<div class="account-banden-right">
					绑定<b>第三方账号</b>，还可以将YAMI的内容同步到以下平台，与更多好友分享。
				</div>
			</div>
			<div class="account-banden-inform">
				<div class="account-banden-left">新浪微博</div>
				<div class="account-inform-right">
					<div id="account-username-sina" class="account-username"
					style="display: none;"></div>
					<span id="third-sina-bind" style="display: none" class="account-inform-right pull-left" data=""><img style="height: 40px;width: 40px;"/><span></span>zxj</span>
					<a id="account-sina-pic"
					href="https://api.weibo.com/oauth2/authorize?client_id=3997331221&response_type=token&redirect_uri=http://jishanjia.com/login/bind&scope=all"
					class="account-pic">绑定账号</a> 
					<a href="#" id="remove-sina-bind" style="display: none" class="account-pic" data="">解除绑定</a>

				</div>
			</div>
			<div class="account-banden-inform">
				<div class="account-banden-left">腾讯QQ</div>
				<div class="account-inform-right pull-left">
					<div id="account-username-qq" class="account-username"
					style="display: none"></div>
					<span id="third-qq-bind" style="display: none" class="account-inform-right pull-left" data=""><img style="height: 40px;width: 40px;"/><span></span></span>
					<a id="account-qq-pic" href="https://graph.qq.com/oauth2.0/authorize?response_type=token&client_id=101021509&redirect_uri=jishanjia.com/login/bind&scope=get_user_info" class="account-pic">绑定账号</a> 
					<a id="remove-qq-bind" href="#"  style="display: none" class="account-pic" data="">解除绑定</a>
				</div>
			</div>
			<br style="clear: both;" />
		</div>
		<!--收货地址-->
		<div class="tab-pane" id="panel-address">
			<div class="message-content" id="panel-address-count">
				<div class="loading-round"></div>
			</div>
		</div>
	</div>
	</div>
</div>
<!-- 个人资料 -->
<script type="text/html" id="proSetTbody-template">
<tr>
<input type="hidden" value="<$=user.avatar $>" name="avatar" class="userAvatar">  
<td class="column1" colspan="4">
<div class="account-div-left">头像设置</div> <label for="coverId"
class=""></label>
<div class="portrait" id="portrait">
<span id="change-img">修改</span> 
<div id="file-preview">
<img src="<$=user.avatarUrl$>/100x100"/ id="portrait-img">
</div>
<label id="fileupload" for="correctPortrait"><input
id="correctPortrait" type="file" name="pic"></label>
</div>
</td>
</tr>
<tr>
<td class="column1" colspan="4">
<div class="account-name">
<div class="account-div-left">昵称</div>
<input type="text" class="account-div-right" name="name" rangelength="0,20" title="昵称不超过20个字符！"
value="<$=user.name$>" />
</div>
</td>
</tr>
<tr>
<td class="column1 sex" colspan="4" data="<$=user.gender$>">
<div class="account-div-left">性别</div>
<div class="span1">
<label for="man" >男</label><input class="man" type="radio" name="sex" id="man" value="1">
</div>
<div class="span1">
<label for="woman" >女</label><input class="woman" type="radio" name="sex" id="woman" value="0">
</div>
</td>
</tr>
<tr>
<td class="column1" colspan="4">
<div class="account-div-left">所在地</div> <input type="text" class="account-div-right" name="address" value="<$=user.address$>" rangelength="0,50" title="所在地不超过50个字符！" />
</td>
</tr>
<tr>
<td class="column1" colspan="4">
<div class="account-div-left">自我介绍</div> <textarea name="description" rangelength="0,100" title="自我介绍不超过100个字符！"><$=user.description$></textarea>
</td>
</tr>
<tr>
<td class="column1" colspan="4">
<div class="account-div-left">腾讯QQ</div> <input type="text" class="account-div-right digits" id="QQ" name="qq" value="<$=user.qq$>" rangelength="0,500" title="qq不超过20数字！"/>
</td>
</tr>
<tr>
<td class="column1" colspan="4">
<div class="account-div-left">微博或博客</div> <input type="text" class="account-div-right" id="weiboUrl" name="weiboUrl" value="<$=user.weiboUrl$>" rangelength="0,500" title="微博不超过20个字符！"/>
</td>
</tr>

<tr>
<td class="column1" colspan="4">
<div class="account-div-left"></div> <input type="submit" class="account-set" style="height: 40px; width: 120px;" value="保存设置" />
</td>
</tr>
</script>
<!-- 通知设置 -->
<script type="text/html" id="note-set-template">

</script>

<!-- 添加收获地址 -->
<div id="upModal" class="modal hide fade" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal"
				aria-hidden="true">×</button>
			<h4 style="margin: 0px;" id="myModalLabel">添加/修改地址</h4>
		</div>
		<div class="modal-body ">
			<form class="table form-horizontal" id="addMessage">
				 <input
					type="hidden" id="addre-id" name="id"> <input type="hidden"
					id="user-uid" name="uid" value=''>
					<input
					type="hidden" id="addre-id" name="id">
					 <input type="hidden"
					id="user-id" name="user.id">
				<div class="control-group">
					<label class="control-label span3" for="inputEmail"><span>*</span>收货人
					</label>
					<div class="controls span9">
						<input type="text" name="name" id="applicantName" class="required" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label span3" for="inputEmail"><span>*</span>所在地区
					</label>
					<div class="controls span9">
						<input type="hidden" id="region-province-id" name="provinceId">
						<input type="hidden" id="region-city-id" name="cityId"> <input
							type="hidden" id="region-county-id" name="districtId"> <select
							id="region-province-select" class="span3"><option>省</option></select>
						<select id="region-city-select" class="span3"><option>市</option></select>
						<select id="region-county-select" class="span3"><option>县、区</option></select>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label span3" for="inputEmail"><span>*</span>详细地址
					</label>
					<div class="controls span9">
						<input type="text" id="appaddress" class="required"
							name="endRegion">
					</div>
				</div>
				<div class="control-group">
					<label class="control-label span3" for="inputEmail"><span>*</span>收货人电话
					</label>
					<div class="controls span9">
						<input type="text" name="phone" id="applicantPhone"
							class="required" />
					</div>
				</div>
				<div class="control-group">
					<label class="control-label span3" for="">
					</label>
					<div class="controls span9">
						<label class="radio inline"> <input type="radio"
							name="isDefault" value="1" id="default-one" >设置为默认地址
						</label> <label class="radio inline"> <input type="radio"
							name="isDefault" value="0" id="default-two" checked="checked">不设置为默认地址
						</label>
					</div>
				</div>
			</form>
		</div>
		<div class="modal-footer">
					<div class="pull-left subtn">
						<button type="button" class="btn btn-primary addto-address" id="add-submit">添加</button>
			           <button type="button" class="btn btn-primary update-address" id="add-submit">修改</button>
					</div>
		</div>
	</div>

	<!--  收货地址管理     -->
	<script type="text/html" id="panel-address-template">


<table class="table table-hover">
					<thead>
						<tr class="home_jsb_title">
							<th class="activity_name" colspan="4" style="border-bottom:1px solid #ddd;">地址管理</th>
							<th style="border-bottom:1px solid #ddd;" class=" activity_name "><buttn class="btn-link pull-right address-btn" data-toggle="modal" data-target="#upModal">添加新地址</button></th>
						</tr>
					</thead>
</table>
<$ if (result.length <= 0 ) { $>
<span class="empty-center">还没有收货地址哦</span>
<$} else {$>

	<table class="table table-hover table-condensed">
		<thead>
			<tr>
				<th width="10%">收货人</th>
				<th width="20%">收货地址</th>
				<th width="25%">街道地址</th>
				<th width="20%">联系电话</th>
				<th width="10%">默认地址</th>
				<th width="15%">操作</th>
			</tr>
		</thead>
		<tbody>
		<$for(var i = 0;i<result.length;i++){$>
			<tr>
				<td><$=result[i].name$></td>
				<td class="address<$=i$>"></td>
				<td><$=result[i].endRegion$></td>
				<td><$=result[i].phone$></td>
				<td>
					<$if(result[i].isDefault==1){$>
						<i class="icon-ok"></i>
					<$}$>
				</td>
				<td>
					<a class="btn btn-link btn-xs addre-upd" href="#" key="<$=i$>" data='{"name":"<$=result[i].name$>","cityId":"<$=result[i].cityId$>","districtId":"<$=result[i].districtId$>","provinceId":"<$=result[i].provinceId$>","endRegion":"<$=result[i].endRegion$>","phone":"<$=result[i].phone$>","id":"<$=result[i].id$>","uid":"<$=result[i].user.id$>","isdefault":"<$=result[i].isDefault$>"}'>修改</a>
					<a class="btn btn-link btn-xs addre-del" href="#" data="<$=result[i].id$>">删除</a>
				</td>
			</tr>
		<$}$>
		</tbody>
	</table>
<$}$>
</script>



<c:if test="${env == 'production' }">
<script type="text/javascript">
seajs.use("${ctx}/assets/js-dist/home/profile-page");
</script>
</c:if>
<c:if test="${env != 'production' }">
<script type="text/javascript">
seajs.use("${ctx}/assets/js/home/profile-page");
</script>
</c:if>

